package com.xiaouyudeguang.common.dicode.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import org.springframework.data.domain.PageImpl;

import java.util.List;
import java.util.Map;
import java.util.Set;

public interface AbstractService<T> extends IService<T> {

    String save(String tenantId, String appId, String tableName, JsonNode request) throws Exception;

    boolean saveBatch(String tenantId, String appId, String tableName, ArrayNode dataList) throws Exception;

    boolean deleteById(String tenantId, String appId, String tableName, String id) throws Exception;

    boolean deleteByIds(String tenantId, String appId, String tableName, Set<String> ids) throws Exception;

    boolean updateById(String tenantId, String appId, String tableName, JsonNode request) throws Exception;

    boolean updateByIds(String tenantId, String appId, String tableName, JsonNode request) throws Exception;

    boolean updateBatch(String tenantId, String appId, String tableName, ArrayNode dataList) throws Exception;

    JsonNode getById(String tenantId, String appId, String tableName, String id) throws Exception;

    ObjectNode getOne(String tenantId, String appId, String tableName, JsonNode request) throws Exception;

    List<ObjectNode> getByIds(String tenantId, String appId, String tableName, Set<String> ids) throws Exception;

    List<ObjectNode> list(String tenantId, String appId, String tableName, JsonNode request) throws Exception;

    Set<String> listIds(String tenantId, String appId, String tableName, JsonNode request) throws Exception;

    List<ObjectNode> tree(String tenantId, String appId, String tableName, JsonNode request) throws Exception;

    PageImpl<ObjectNode> page(String tenantId, String appId, String tableName, JsonNode request) throws Exception;

    List<ObjectNode> export(String tenantId, String appId, String tableName, JsonNode request) throws Exception;

    String upload(String tenantId, String appId, String tableName, List<Map<String, Object>> dataList) throws Exception;

    Boolean update(String tenantId, String appId, String tableName, String tableApi, JsonNode request) throws Exception;

    Boolean delete(String tenantId, String appId, String tableName, String tableApi, JsonNode request) throws Exception;

    Object page(String tenantId, String appId, String tableName, String tableApi, JsonNode request) throws Exception;
}
